<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script type="text/javascript" src="/js/jquery-3.2.1.min.js"></script>
</head>
<body>
    <div>
        <span id="email"></span> 欢迎登录系统！
    </div>
    <script type="text/javascript">

        $(document).ready(function(){
            // 根据token获取Email地址
            var token = sessionStorage.getItem("token");
            $.ajax({
                url: "http://localhost:80/api/user/info/"+token,
                beforeSend: function(request) {
                    request.setRequestHeader("token", token);
                },
                method: "get",
                success: function (data) {
                    if(data.code==200){
                        $("#email").html(data.msg);
                    }
                },
                error: function (data) {
                    alert ("请求出错！");
                }
            })
        })
    </script>
</body>
</html>